﻿using System.Speech.Synthesis;

public static class SimpleSpeaker
{
    private static SpeechSynthesizer synth = new SpeechSynthesizer();
    /*
    SimpleSpeaker.Success();
    SimpleSpeaker.Say("欢迎使用本系统");
    SimpleSpeaker.Failure();
    */
    static SimpleSpeaker()
    {
        synth.Volume = 100;
        synth.Rate = 0;
    }

    public static void Say(string text)
    {
        synth.SpeakAsync(text);
    }

    public static void Success()
    {
        Say("操作成功");
    }

    public static void Failure()
    {
        synth.Volume = 100;
        Say("错误！操作失败");
        synth.Volume = 80;
    }

    public static void Warning()
    {
        Say("请注意，操作警告");
    }
}

